package com.atguigu.srb.core.controller;


import com.atguigu.srb.common.result.R;
import com.atguigu.srb.core.pojo.entity.Dict;
import com.atguigu.srb.core.service.DictService;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 数据字典 前端控制器
 * </p>
 *
 * @author LiLi
 * @since 2021-09-23
 */
@RestController
@RequestMapping("/api/core/dict")
public class DictController {
    @Autowired
    DictService dictService;

    @ApiOperation("根据字典代码查询字典集合")
    @GetMapping("findByDictCode/{dictCode}")
    public R findByDictCode(
            @ApiParam("字典表的字典代码")
            @PathVariable("dictCode") String dictCode ){

        List<Dict> list = dictService.findByDictCode(dictCode);
        return R.ok().data("list",list);
    }
}

